package com.xuhuan.practice.validation.annotation;

import com.xuhuan.practice.validation.validator.ArticleStateValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author: huan.xu
 * @create: 2024/6/11 22:42
 * @description: 文章状态注解
 **/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {ArticleStateValidation.class})
public @interface ArticleState {

  String message() default "文章状态[state]的值只能是已发布或者草稿";

  Class<?>[] groups() default {};

  Class<? extends Payload>[] payload() default {};

}
